#!/bin/bash
##替换yum源
read -p "是否需要更换yum[虚拟机建议更换,云服务器使用默认即可]
输入y即可开始更换yum，若前面使用本脚本更换过则无需再更换" yumupdate
if [ $yumupdate == y ];then
	echo -e '正在更新yum'
	lj=`pwd`
	cd /etc/yum.repos.d/
	yum install -q -y wget
	rm -rf /etc/yum.repos.d/CentOS-Base.repo
	wget http://mirrors.aliyun.com/repo/Centos-7.repo
	wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
	yum clean all 
	yum makecache
	read -p "是否需要全部更新,全部更新用时较长[y/n]" allupdate
	if [ $allupdate == y ];then
		yum update
	else	
		echo 
	fi
	cd $lj
else
	echo -e '请开始选择菜单'
fi